package com.zhiyou.app.common.constant;

import cn.hutool.cache.impl.TimedCache;
import com.zhiyou.app.common.util.EnhancedExpiringMap;
import com.zhiyou.app.common.ws.ComfyuiTaskInfo;
import com.zhiyou.app.common.ws.ObservableAtomicReference;
import com.zhiyou.app.pojo.entity.OrderEntity;
import com.zhiyou.app.pojo.vo.dict.DictPool;
import com.zhiyou.app.pojo.vo.dict.IdColorItem;
import com.zhiyou.app.pojo.vo.dict.IdSizeGroup;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.servlet.mvc.method.annotation.SseEmitter;

import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.TimeUnit;

@Slf4j
public class CommonConstant {
    public final static String STAFF_PREFIX = "staff";
    public final static String MINI_USER_PREFIX = "mini";
    public final static String MAX_ID_ORDER_COUNT_4_DAY = "ORDER_COUNT_4_DAY_";
    public final static Integer MAX_ID_ORDER_COUNT_4_DAY_VALUE = 100;
    public final static List<IdSizeGroup> ID_SIZE_GROUP_LIST = new ArrayList<>();
    public final static List<IdColorItem> ID_COLOR_LIST = new ArrayList<>();
    public final static DictPool DICT_POOL = new DictPool();
    public final static String REDIS_TASK_ID_PREFIX = "comfyui:task:id:%s";
    public final static String REDIS_OLD_TASK_COMPLETE_FLAG_PREFIX = "comfyui:old:task:complete:id:%s";

    public static final ObservableAtomicReference<ComfyuiTaskInfo> CURRENT_TASK_INFO = new ObservableAtomicReference<>("current-task");
    public static EnhancedExpiringMap<String, OrderEntity> ORDER_MAP_4_COMPLETE = new EnhancedExpiringMap<>(3, TimeUnit.DAYS);
}
